<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    <!--[if IE]>  <script src="excanvas.js"></script>  <![endif]-->

    <script type="text/javascript" src="../assets/javascript/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="../assets/javascript/json2.js"></script>    
    <script type="text/javascript" src="../lib/browserReady.js"></script>
    <script type="text/javascript" src="../lib/handles.js"></script>
    <script type="text/javascript" src="../lib/log.js"></script>
    <script type="text/javascript" src="../lib/primitives.js"></script>
    <script type="text/javascript" src="../lib/style.js"></script>
    <script type="text/javascript" src="../lib/matrix.js"></script>
    <script type="text/javascript" src="../lib/builder.js"></script>
    <script type="text/javascript" src="../lib/util.js"></script>
    <script type="text/javascript" src="../lib/text.js"></script>
    <script type="text/javascript" src="../lib/figures.js"></script>
    <script type="text/javascript" src="../lib/connections.js"></script>
    <script type="text/javascript" src="../lib/connectionManagers.js"></script>
    <script type="text/javascript" src="../lib/groups.js"></script>

    <script type="text/javascript" src="../lib/sets/basic.js?<?=time()?>"></script>
    <script type="text/javascript" src="../lib/sets/secondary.js?<?=time()?>"></script>
    
    <script type="text/javascript" src="../lib/stack.js"></script>
    <script type="text/javascript" src="../lib/main.js"></script>
    <link type="text/css" href="../assets/css/style.css" rel="stylesheet"/>

    <!--TESTS-->
    <script type="text/javascript" src="testunits/testCore.js"></script>
    <script type="text/javascript" src="testunits/unitBrowserReady.js"></script>
    <script type="text/javascript" src="testunits/unitPrimitives.js"></script>
    <script type="text/javascript" src="testunits/unitUtil.js"></script>
    <script type="text/javascript" src="testunits/unitText.js"></script>
    <script type="text/javascript" src="testunits/unitSerialization.js"></script>
    <script type="text/javascript" src="testunits/unitMiscellaneous.js"></script>
    <script type="text/javascript">
        /**The collection of test units
         *Each element must have the exact name of the unit defined in the unit's js file
         *Ex: unitBrowserReady for unitBrowserReady.js
         **/
        var testUnits = [
            unitBrowserReady,
            unitPrimitives,
            unitUtil,
            unitText,
            unitSerialization
        ];
    </script>

    <script type="text/javascript">

        function test() {
            /* specified test
             * @see http://www.w3schools.com/jsref/prop_loc_search.asp search property of the location object
             * */
            if (location.search.substr(0, '?unittest='.length) == '?unittest=') { //do we have a test specified?
                var testName = location.search.substr('?unittest='.length); //get the name of the test
                $("#automaticTests").html( performUnitTest(window[testName]).msg );
                //TODO: why not use: $("#automaticTests").html( performUnitTest(testUnits[testName]).msg );
                $('#manualTests').hide();
            }

            // all tests
            else {
                var success = true;
                var unitMessages = '';
                for (var i in testUnits) {
                    var unit = testUnits[i];
                    var r = performUnitTest(unit);
                    success &= r.success;
                    unitMessages += '<li><a href="tests.html?unittest=' + unit.id + '">' + unit.id + '</a> ' + unit.name + ': ' + resultToString(r.success) + '</li>';
                }
                $("#automaticTests").html('<h2>Automated test units: ' + resultToString(success) + '</h2><ul>' + unitMessages + '</ul>');
                $('#manualTests').show();
            }
        } //end function

    </script>
  </head>
  <body onload="test();">
      
      <div id="automaticTests"></div>

      
    <canvas id="a" style="display: none"></canvas>
  </body>
</html>
